﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category0
{
  public class MT057 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagSubItemDefinition U0008;

    [Description("Section Number")]
    public Tag202 SectionNumber_202
    {
      get
      {
        return new Tag202((SwiftElement) this, 0, (SwiftDefinitionElement) MT057.U0002);
      }
    }

    [Description("Section Number")]
    public Tag202 Tag202_SectionNumber
    {
      get
      {
        return this.SectionNumber_202;
      }
    }

    [Description("")]
    public Tag203 TotalSections_203
    {
      get
      {
        return new Tag203((SwiftElement) this, 0, (SwiftDefinitionElement) MT057.U0004);
      }
    }

    [Description("")]
    public Tag203 Tag203_TotalSections
    {
      get
      {
        return this.TotalSections_203;
      }
    }

    [Description("Region Information")]
    public Tag334[] RegionInformation_334
    {
      get
      {
        int index = -1;
        List<Tag334> list = new List<Tag334>();
        int count;
        do
        {
          ++index;
          Tag334 tag334 = new Tag334((SwiftElement) this, index, (SwiftDefinitionElement) MT057.U0006);
          count = this.ListTags((SwiftElement) tag334).Count;
          if (count > 0)
            list.Add(tag334);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Region Information")]
    public Tag334[] Tag334_RegionInformation
    {
      get
      {
        return this.RegionInformation_334;
      }
    }

    public MT057()
      : base(true)
    {
    }

    public MT057(SwiftMessage message)
      : base(message)
    {
    }

    public Tag334 AddRegionInformation_334()
    {
      return new Tag334((SwiftElement) this, this.RegionInformation_334.Length, (SwiftDefinitionElement) MT057.U0006)
      {
        Value = string.Empty
      };
    }

    public void RemoveRegionInformation_334(Tag334 tag)
    {
      this.RemoveTag(tag.GetTag());
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT057.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT057.MessageDefinition = new SwiftMessageDefinition("MT057", "Time Zone Status Report");
      MT057.U0002 = new SwiftTagDefinition("SectionNumber_202", "Section Number");
      MT057.U0002.TagName = "{202:";
      MT057.U0003 = new SwiftTagSubItemDefinition("SectionNumber", "Section Number");
      MT057.U0002.Elements.Add((SwiftDefinitionElement) MT057.U0003);
      MT057.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT057.U0002);
      MT057.U0004 = new SwiftTagDefinition("TotalSections_203", "");
      MT057.U0004.TagName = "{203:";
      MT057.U0005 = new SwiftTagSubItemDefinition("TotalSections", "Total Sections");
      MT057.U0004.Elements.Add((SwiftDefinitionElement) MT057.U0005);
      MT057.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT057.U0004);
      MT057.U0006 = new SwiftTagDefinition("RegionInformation_334", "Region Information");
      MT057.U0006.TagName = "{334:";
      MT057.U0006.Multiple = true;
      MT057.U0007 = new SwiftTagSubItemDefinition("Region", "Region");
      MT057.U0006.Elements.Add((SwiftDefinitionElement) MT057.U0007);
      MT057.U0008 = new SwiftTagSubItemDefinition("HoursMinutes", "");
      MT057.U0006.Elements.Add((SwiftDefinitionElement) MT057.U0008);
      MT057.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT057.U0006);
    }
  }
}
